<template>
  <div style="padding:20px;display: flex;flex-wrap: wrap;">
    <div v-for="o in companyList" :v-key="o.id" style="flex-shrink: 1;flex-grow: 1;width: 500px;margin: 5px;" @click="enter(o)">
      <el-card shadow="hover">
        <div slot="header">
          <div style="font-family:微软雅黑;font-size: 30px; ">{{ o.c }} </div>
        </div>
        <div>
          热度：{{ o.count }}
        </div>
      </el-card>
    </div>
  </div>
</template>

<script>
import { CompanyList } from '@/api/api.js'

export default {
  name: 'CompanyList',
  data() {
    return {
      companyList: [],
      companyListData: [],
      keyword: ''
    }
  },
  async created() {
    this.companyList = this.companyListData = await CompanyList()
  },
  methods: {
    filterCompany: function() {
      const _this = this
      this.companyList = this.companyListData.filter(function checkAdult(item) {
        const index = item.c.indexOf(_this.keyword)
        return index != -1
      })
    },
    enter(item) {
      this.$router.push({ name: 'cpy', params: { cname: item.c }})
    }
  }
}
</script>

<style scoped>
    .transition-box {
        margin-bottom: 10px;
        width: 200px;
        height: 100px;
        border-radius: 4px;
        background-color: #409EFF;
        text-align: center;
        color: #fff;
        padding: 40px 20px;
        box-sizing: border-box;
        margin-right: 20px;
    }
</style>
